<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <input type="text" id="token" placeholder="请输入token">
    <button>发起携带token的请求</button>
    <script>
        const button = document.querySelector('button');
        
        
        const apiClient = axios.create({
            baseURL: 'http://localhost:8080',
            
        });
        button.addEventListener('click', () => {
            const token = document.querySelector('#token').value;
            apiClient.get('/hello_Login', {
                headers: {
                'Authorization': `Bearer ${token}`,
                'Content-Type': 'application/json'
            }}).then(res => {
                console.log(res);
            }).catch(err => {
                console.log(err);
            });
        });
    </script>
</body>

</html>